import request, {exportFile} from '../request'
import {AxiosRequestConfig} from 'axios'

/**
 * 查询资源列表
 * @param params
 * @returns 
 */
export const getResourceList = (params:any) => {
  return request.get('/archery/asset/get_resource', {params})
}

/**
 * 新增资源
 * @param data
 * @returns 
 */
export const addResource = (params:any, data:any) => {
  return request.post('/archery/asset/get_resource', data, {params})
}

/**
 * 更新修改资源
 * @param params
 * @param data
 * @returns
 */
export const updateResource = (params:any, data:any) => {
  return request.put('/archery/asset/get_resource', data, {params})
}

/**
 * 删除资源
 * @param params
 * @returns
 */
export const delResource = (params:any) => {
  return request.delete('/archery/asset/get_resource', {params})
}

/**
 * 查询资源下拉数据
 */
export const queryResourceCondtion = (params:any, data?:any) => {
  return request.post('/archery/asset/search_list', data, {params})
}

/**
 * 下载导入模版
 */
export const importDataTemplate = () => {
  return exportFile({
    url: '/archery/asset/import_data',
    method: 'get'
  }, '导入模版.xlsx')
}

/**
 * 导出
 */
export const exportData = (params:any) => {
  return exportFile({
    url: '/archery/asset/import_data',
    method: 'get',
    params
  }, '网络设备.xlsx')
}

/**
 * 导入
 * @param data
 * @param options
 * @returns
 */
export const importData = (data:any, options:AxiosRequestConfig<any>) => {
  return request.post('/archery/asset/import_data', data, options)
}

/**
 * 查看账户
 */
export const getDeviceAccount = (params:any) => {
  return request.get('/archery/asset/device_account', {params})
}

/**
 * 关联账户
 */
export const contactDiviceAccount = (data:any) => {
  return request.post('/archery/asset/device_account', data)
}

/**
 * 查看登录日志
 */
export const getLoginRecords = (params:any) => {
  return request.get('/archery/asset/login_record', {params})
}

/**
 * 获取ssh登录配置
 * @param params
 * @returns
 */
export const getSshConfig = (params:any, type:string) => {
  return request.get(`/base_platform/backend/${type}/`, {params})
}